#pragma once

#include "Acceptor.h"
#include "EventLoop.h"

class TcpServer
{
    using TcpConnectionPtr = shared_ptr<TcpConnection>;
    using TcpConnectionCallback = function<void(const TcpConnectionPtr &)>;
public:

    TcpServer(const string &ip, unsigned int port);
    ~TcpServer();
    void start();
    void stop();
    void setAllCallbacks(TcpConnectionCallback &&cb1, 
                         TcpConnectionCallback &&cb2,
                         TcpConnectionCallback &&cb3);
private:
    Acceptor _acceptor;
    EventLoop _loop;
};

